package cn.kuporo.seckill.stock.domain.repository;

import cn.kuporo.seckill.stock.domain.model.entity.SeckillStockBucket;

import java.util.List;

/**
 * @author: kuporo
 * @since: 2025/8/1
 * @description: 商品库存Repository接口
 */
public interface SeckillStockBucketRepository {
    /**
     * 暂停库存
     */
    boolean suspendBuckets(Long goodsId);

    /**
     * 根据商品id获取库存分桶列表
     */
    List<SeckillStockBucket> getBucketsByGoodsId(Long goodsId);

    /**
     * 恢复库存
     * @param goodsId 商品id
     * @return
     */
    boolean resumeBuckets(Long goodsId);

    /**
     * 批量提交商品库存信息
     * @param goodsId 商品id
     * @param buckets 分桶列表
     * @return
     */
    boolean submitBuckets(Long goodsId, List<SeckillStockBucket> buckets);

    /**
     * 扣减库存
     */
    boolean decreaseStock(Integer quantity, Integer serialNo, Long goodsId);
}
